package smartt.styy.auth.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import smartt.styy.auth.constants.RedisConstants;
import smartt.styy.auth.service.VcodeManager;
import smartt.styy.auth.service.VerificationCodeService;

@Service
public class VerificationCodeServiceImpl implements VerificationCodeService {

	@Autowired
	private VcodeManager vcodeManager;
	
	//重置密码，验证短信vcode
	@Override
	public boolean verifyVerificationCode(String cellphoneNumber, String verificationCode) throws Exception {
		String errNum =new String("");
		Object redisVcodeErrNum =vcodeManager.getVcode(RedisConstants.REDIS_RESETPWD_PREFIX,cellphoneNumber);
		if(null != redisVcodeErrNum){
			errNum = redisVcodeErrNum.toString();
		}
		
		if(verificationCode.equals(errNum)){
			return true;
		}
		
		return false;
	}

}
